import types from './../types/index';
import actions from './../actions/index' ;

const common  = {
    state: {
        songs:[],
        songCount:[],
        banners:[] ,
        videoList: [] ,
        playAddress :'' ,
        orderLists: [] ,
        viewDirection : String
    },
    mutations: {
        //搜索关键词
        [types.SEARCH](state , params ){
            ajax.get({
                url:'/search',
                data:params
            }).then((res) => {
                this.state.songs = res.data.result.songs ;
                this.state.songCount = res.data.result.songCount ;
                console.log(res.data)
            })
            .catch((error) => {
                console.log(error)
            })
        },
        //获取banner图
        [types.GETBANNER](state,action){
            state.banners = action ;
        },
        [types.GETORDER](state,action){
            state.orderLists = action ;
            console.log(state.orderLists)
        },
        //获取视频列表
        [types.GETVIDEOLIST](state,action){
            state.videoList = action ;
        },
        [types.PLAYMV](state,action){
            state.playAddress = action.data.brs['1080'] ;
        }
    },
    actions: actions,
    getters: {

    }
}
export default common ;